package com.atguigu.gulimall.member.web;

import com.atguigu.common.utils.R;
import com.atguigu.gulimall.member.feign.OrderFignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

/**
 * @author ming
 * @create 2022/5/12
 * @description:
 */
@Slf4j
@Controller
public class MemberWebController {
    @Autowired
    private OrderFignService orderFignService;
    @GetMapping("/memberOrder.html")
    public String memberOrderPage(@RequestParam(value="pageNum",defaultValue="1")Integer pageNum, Model model){
        //查出当前用户的所有列表数据
        Map<String,Object> page = new HashMap<String,Object>();
        page.put("page",pageNum.toString());
        R r = orderFignService.listWithItem(page);
        model.addAttribute("orders",r);
        log.info("r:{}",r);
        return "orderList";
    }
}
